
import { DatePipe } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { NzModalService } from 'ng-zorro-antd/modal';
import { ContractManagementService } from '../../services/contract-management.service';

@Component({
  selector: 'app-contract-management-detail-complaint',
  templateUrl: './contract-detail.component.html',
  styleUrls: ['./contract-detail.component.less'],
  providers: [DatePipe]
})
export class ContractManagementDetailComponent implements OnInit {
  constructor(
    public service: ContractManagementService,
    public route: ActivatedRoute
  ) {}
  textStatus = '合同详情';
  name: any;
  code: any;
  templateHTML: any;
  detailList: any = {
    templateName: ''
  };
  ngOnInit() {
    this.initData(this.service.$api_contract_get);
  }
  goBack() {
    window.history.go(-1);
  }

  initData(url: string) {
    this.service.request(url, { id: this.route.snapshot.params.id }).subscribe(res => {
      if (res) {
        this.detailList = res;
        this.detailList = res;
        let value: any = JSON.parse(res.contractParameter);
        this.code = value['${code}'];
        this.name = value['${name}'];
      }
    });
  }
  cancel() {
    window.history.go(-1);
  }
}
